﻿using Microsoft.Practices.SharePoint.Common.Configuration;
using Microsoft.SharePoint;
using SharePoint.Contrib.App.Settings;

namespace SharePoint.Contrib.Extensions
{
    /// <summary>
    /// Extensions for the SPWeb class
    /// </summary>
    public static class SPWebExtensions
    {
        /// <summary>
        /// Retrieves the collection of settings for the SPWeb
        /// </summary>
        public static ISettingCollection Settings(this SPWeb instance)
        {
            IPropertyBag properties = instance.PropertiesBag();
            return new SPSiteSettingCollection(properties, instance);
        }

        private static IPropertyBag PropertiesBag(this SPWeb instance)
        {
            IPropertyBag properties = new SPWebPropertyBag(instance);
            return properties;
        }

    }
}
